<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	pageContext.setAttribute("APP_PATH", request.getContextPath());
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>添加商品</title>
<script type="text/javascript"
	src="${APP_PATH}/static/js/jquery-2.1.1.min.js"></script>
<link
	href="${ pageContext.request.contextPath }/static/bootstrap-3.3.7-dist/css/bootstrap.min.css"
	rel="stylesheet">
<style type="text/css">
.tabl .tt {
	font-size: 15px;
	font-weight: bold;
}

.tabl {
	height: 460px;
}

.tabl td input {
	height: 30px;
	width: 260px;
	border-radius: 4px;
	font-size: 14px;
}

.tabl .sele {
	height: 36px;
	width: 260px;
	border-radius: 4px;
}
</style>
<script type="text/javascript">
	function edit() {
		var r = confirm("确定修改吗？");
		if (r == true) {
			window.location.href = "${pageContext.request.contextPath}/admin/adminProduct_update.action";
			alert("商品修改成功");
		} else {
			alert("取消修改商品");
			window.location.reload();
		}
	}
	function refresh() {
		window.location.href = "${pageContext.request.contextPath}/admin/adminProduct_findAllByPage.action?page=1";
	}
</script>
</head>
<body>
	<div>
		<div class="b" style="float: left; padding-left: 30px;">
			<h2>商品编辑</h2>
		</div>

		<div align="right" style="padding-right: 60px; padding-top: 20px;">
			<input class="btn btn-info" type="button" onclick="refresh()"
				value="返回" style="margin-left: 600px;" align="right" />
		</div>
	</div>

	<hr
		style="height: 1px; border: none; border-top: 1px solid #555555; width: 95%" />
	<div style="margin-left: 60px; margin-bottom: 20px;" class="formm">
		<form id="userAction_save_do" name="Form1"
			action="${pageContext.request.contextPath}/admin/adminProduct_update.action"
			method="post" enctype="multipart/form-data">
			<input type="hidden" name="pid" value="${findByPid.pid}" /> <input
				type="hidden" name="image" value="${findByPid.image}">
			<table class="tabl">
				<tr height="50">
					<td class="tt">商品名称：</td>
					<td width="20"></td>
					<td><input type="text" name="pname" value="${findByPid.pname}"
						id="userAction_save_do_logonName" class="bg" />
				</tr>
				<tr height="50">
					<td class="tt">是否热门：</td>
					<td width="20"></td>
					<td><select name="isHot" class="sele">
							<c:if test="${findByPid.isHot==1}">
								<option value="1" selected>是</option>
								<option value="0">否</option>
							</c:if>
							<c:if test="${findByPid.isHot==0}">
								<option value="1">是</option>
								<option value="0" selected>否</option>
							</c:if>

					</select></td>
				</tr>
				<tr height="50">
					<td class="tt">市场价格：</td>
					<td width="20"></td>
					<td><input type="text" name="marketPrice"
						value="${findByPid.marketPrice}" id="userAction_save_do_logonName"
						class="bg" />
				</tr>
				<tr height="50">
					<td class="tt">商城价格：</td>
					<td width="20"></td>
					<td><input type="text" name="shopPrice"
						value="${findByPid.shopPrice}" id="userAction_save_do_logonName"
						class="bg" /></td>
				</tr>
				<tr height="50">
					<td class="tt">商品图片：</td>
					<td width="20"></td>
					<td><input type="file" name="file" />&nbsp;<br /> <img
						src="../${findByPid.image}" width="130px" height="120px" /></td>

				</tr>
				<tr height="50">
					<td class="tt">二级分类：</td>
					<td width="20"></td>
					<td><select name="csid" class="sele">
							<c:forEach items="${cslist}" var="cs">
								<c:if test="${cs.csid == findByPid.csid}">
									<option value="${cs.csid}" selected>${cs.csname}</option>
								</c:if>
								<c:if test="${cs.csid != findByPid.csid}">
									<option value="${cs.csid}">${cs.csname}</option>
								</c:if>
							</c:forEach>
					</select></td>
				</tr>
				<tr height="50">
					<td class="tt">商品描述：</td>
					<td width="20"></td>
					<td><textarea name="pdesc" rows="6" cols="38">${findByPid.pdesc}</textarea></td>
				</tr>

				<tr height="50">
					<td align="right"><button type="reset" value="重置"
							class="btn btn-primary">&#37325;&#32622;</button></td>
					<td></td>
					<td align="center">
						<button type="submit" id="userAction_save_do_submit" value="提交"
							class="btn btn-primary" onclick="edit()">&#30830;&#23450;</button>
					</td>
				</tr>

			</table>
		</form>
	</div>
</body>
</html>

